package org.hxyjs.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author
 */
public class Admin implements Serializable, Account {
    private String ano;

    private String aname;

    private String asex;

    private String aage;

    private String aid;

    private String apwd;

    private Integer astate;

    private String aimg;

    private String aemail;

    String salt;//加密用的盐

    Integer isDelete;

    Date createDate;

    List<AccountRole> accountRoles;


    private static final long serialVersionUID = 1L;

    public String getSalt() {
        return salt;
    }

    @Override
    public Boolean getLocked() {
        return null;
    }

    @Override
    public String getCredentialsSalt() {
        return getAccountname() + salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    @Override
    public String getAccountid() {
        return ano;
    }

    @Override
    public String getAccountname() {
        return aname;
    }

    @Override
    public String getPassword() {
        return apwd;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public List<AccountRole> getAccountRoles() {
        return accountRoles;
    }

    public void setAccountRoles(List<AccountRole> accountRoles) {
        this.accountRoles = accountRoles;
    }

    public String getAno() {
        return ano;
    }

    public void setAno(String ano) {
        this.ano = ano;
    }

    public String getAname() {
        return aname;
    }

    public void setAname(String aname) {
        this.aname = aname;
    }

    public String getAsex() {
        return asex;
    }

    public void setAsex(String asex) {
        this.asex = asex;
    }

    public String getAage() {
        return aage;
    }

    public void setAage(String aage) {
        this.aage = aage;
    }

    public String getAid() {
        return aid;
    }

    public void setAid(String aid) {
        this.aid = aid;
    }

    public String getApwd() {
        return apwd;
    }

    public void setApwd(String apwd) {
        this.apwd = apwd;
    }

    public Integer getAstate() {
        return astate;
    }

    public void setAstate(Integer astate) {
        this.astate = astate;
    }

    public String getAimg() {
        return aimg;
    }

    public void setAimg(String aimg) {
        this.aimg = aimg;
    }

    public String getAemail() {
        return aemail;
    }

    public void setAemail(String aemail) {
        this.aemail = aemail;
    }

    public Admin() {
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Admin other = (Admin) that;
        return (this.getAno() == null ? other.getAno() == null : this.getAno().equals(other.getAno()))
                && (this.getAname() == null ? other.getAname() == null : this.getAname().equals(other.getAname()))
                && (this.getAsex() == null ? other.getAsex() == null : this.getAsex().equals(other.getAsex()))
                && (this.getAage() == null ? other.getAage() == null : this.getAage().equals(other.getAage()))
                && (this.getAid() == null ? other.getAid() == null : this.getAid().equals(other.getAid()))
                && (this.getApwd() == null ? other.getApwd() == null : this.getApwd().equals(other.getApwd()))
                && (this.getAstate() == null ? other.getAstate() == null : this.getAstate().equals(other.getAstate()))
                && (this.getAimg() == null ? other.getAimg() == null : this.getAimg().equals(other.getAimg()))
                && (this.getAemail() == null ? other.getAemail() == null : this.getAemail().equals(other.getAemail()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAno() == null) ? 0 : getAno().hashCode());
        result = prime * result + ((getAname() == null) ? 0 : getAname().hashCode());
        result = prime * result + ((getAsex() == null) ? 0 : getAsex().hashCode());
        result = prime * result + ((getAage() == null) ? 0 : getAage().hashCode());
        result = prime * result + ((getAid() == null) ? 0 : getAid().hashCode());
        result = prime * result + ((getApwd() == null) ? 0 : getApwd().hashCode());
        result = prime * result + ((getAstate() == null) ? 0 : getAstate().hashCode());
        result = prime * result + ((getAimg() == null) ? 0 : getAimg().hashCode());
        result = prime * result + ((getAemail() == null) ? 0 : getAemail().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", ano=").append(ano);
        sb.append(", aname=").append(aname);
        sb.append(", asex=").append(asex);
        sb.append(", aage=").append(aage);
        sb.append(", aid=").append(aid);
        sb.append(", apwd=").append(apwd);
        sb.append(", astate=").append(astate);
        sb.append(", aimg=").append(aimg);
        sb.append(", aemail=").append(aemail);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}